<template>
	<el-dialog title="电子印章选择" v-model="visible" :width="500" destroy-on-close @closed="$emit('closed')">
		<el-main class="nopadding">
			<scTable ref="table" :data="signList" row-key="id" stripe>
				<el-table-column label="签章" prop="" width="100">
					<template #default="scope">
						<div v-if="scope.row.status=='0'">无效</div>
						<div v-else>
							<el-image :src="scope.row.sign"></el-image>
						</div>
					</template>
				</el-table-column>
				<el-table-column label="签章名称" prop="title" width="100" :show-overflow-tooltip="true">
				</el-table-column>
				<el-table-column label="操作" fixed="right" align="right">
					<template #default="scope">
						<el-button-group v-if="scope.row.status!='0'">
							<el-button text type="primary" size="small" @click="submit(scope.row, scope.$index)">选择</el-button>
						</el-button-group>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-dialog>
</template>

<script>
export default {
	props: {
	},
	components: {
	},
	emits: ['success', 'closed'],
	data() {
		return {
			visible: false,
			isSaveing: false,
			password:'',
			//表单数据
			signList: [],
		}
	},
	mounted() {
	},
	methods: {
		//显示
		open() {
			this.visible = true;
			return this
		},
		async getMySealSignList(){
			let res = await this.$API.bpm.bpmSealSign.getMySealSignList.get({password: this.password});
			if (res.code == 200) {
				this.signList = res.data;
			} else {
				this.$alert(res.message, "提示", {type: 'error'})
			}
		},
		//表单提交方法
		submit(row,index) {
			if(row.status=="0")
			{
				this.$alert("印章异常", "提示", {type: 'error'})
			}else
			{
				this.$emit('success',row.sign);
				this.visible = false;
			}
		},
		setData(data) {
			this.password = data;
			this.getMySealSignList();
		},
	}
}
</script>

<style>
</style>
